import {Injectable} from '@angular/core';
import {Subscription} from "rxjs/Subscription";
import {ToolsService} from "@shared/service/tools/tools.service";
import {HttpService} from "@core/http/http.service";
import * as API from "@api/index";
@Injectable()
export class SponsorService {

  public subscription: Subscription = new Subscription();


  constructor(public httpService: HttpService,
              public toolsService: ToolsService) {
  }

  getSponsorList(data) {
    const url = API.SPONSOR_LIST;
    return this.httpService.postJson(url, data).map((res) => res.json());
  }

  getSponsorDetail(data) {
    const url = API.SPONSOR_DETAIL + `?planId=${data}`;
    return this.httpService.get(url).map((res) => res.json());
  }

  addContactInfo(data) {
    const url = API.SPONSOR_CONTACT_ADD;
    return this.httpService.postUrlencode(url, data).map((res) => res.json());
  }

  getFilterInfo() {
    const url = API.SPONSOR_FILTER + `?type=0`;
    return this.httpService.get(url).map((res) => res.json());
  }

}
